package com.sto.stoapp.thread;

import android.content.Context;
import android.os.Handler;
import android.os.Message;

import com.sto.stoapp.http.ServerSmsHttpManager;
import com.sto.stoapp.http.request.ServerSmsRequest;
import com.sto.stoapp.status.EnumTableNames;

public class ServerSmsUploadThread extends BaseThread {

	private Handler handler;
	private EnumTableNames status;
	private ServerSmsRequest entity;
	private Context context;

	public ServerSmsUploadThread(Context context, EnumTableNames status,
			ServerSmsRequest entity, Handler handler) {
		super(context);
		this.context = context;
		this.status = status;
		this.entity = entity;
		this.handler = handler;
	}

	@Override
	public void run() {
		super.run();
		ServerSmsHttpManager httpManager = new ServerSmsHttpManager(context);
		Message msg = handler.obtainMessage();
		msg.obj = httpManager.dopost("http://222.66.39.194:8809/BqSms.ashx",
				entity);
		System.out.println("msg.obj" + msg.obj.toString());
		msg.what = status.ordinal();
		handler.sendMessage(msg);
	}

}
